import { NextApiResponse } from "next";
import { AuthenticatedRequest, withAuth } from "@/common/middleware/auth";
import { SysMenuService } from "@common/service/sys_menu";
import R from "@common/type/response";

export async function handler(req: AuthenticatedRequest, res: NextApiResponse) {
  if (req.method === 'POST') {
    // 新增菜单
    const id = await SysMenuService.create(req.body);
    R.success(res,id);
  } else {
    res.status(405).json({ success: false, message: 'Method Not Allowed' });
  }
}

export default withAuth(handler); 